package kuzha.runtime;

import java.util.Map;

import kuzha.KuzhaObject;

public class StringPattern extends CasePattern {
	public final String value;
	
	private StringPattern(String value) {
		if (value == null)
			throw new IllegalArgumentException();
		this.value = value;
	}
	
	@Override
	public boolean match(KuzhaObject value, Map<String, KuzhaObject> vars) {
		return value instanceof KzString && this.value.equals(((KzString)value).value);
	}
	
	public static StringPattern valueOf(String value) {
		return new StringPattern(value);
	}
}
